<template>
  <view class="content">
    <view class="fao-info-box">
      <view class="fao-info-bt">
        <view class="fao-bt-h4">{{data.title}}</view>
        <text class="fao-bt-txt">发布于：{{data.update_time}}</text>
      </view>
      <view class="fao-info-main">
        <rich-text :nodes="data.content"></rich-text>
      </view>
    </view>
  </view>
</template>

<script>

export default {

  data() {
    return {
      data: ""
    };
  },
  onLoad(id) {
    if (id.id == '通知') {
      this.tongz();
      
    }else{
      this.get(id.id);
    }
    
  },
  methods: {
    get(id) {
      var than = this;
      uni.request({
        url: getApp().globalData.http + "/page/info",
        data: { id: id },
        method: "post",
        header: {
          "content-type": "application/x-www-form-urlencoded",
          token: uni.getStorageSync("token")
        },
        success: res => {
          if (res.data.code == 1) {
            than.data = res.data.data;
          } else {
            wx.showToast({
              title: res.data.msg,
              icon: "none",
              duration: 2000
            });
          }
        }
      });
    },
    tongz(){
	    var than = this;
			uni.request({
				url: getApp().globalData.http + "/config/notify",
				data: {},
				method: "post",
				header: {
					"content-type": "application/x-www-form-urlencoded",
					token: uni.getStorageSync("token")
				},
				success: res => {
					if (res.data.code == 1) {
						than.data = res.data.data
					} else {
						wx.showToast({
							title: res.data.msg,
							icon: "none",
							duration: 2000
						});
					}
				}
			});
    }
  }
};
</script>
